﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Uc_Product_ProductDetail : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["pi"] != null)
        {
            string pid = Request.QueryString["pi"].ToString();
            int productid = 0;
            try
            {
                productid = int.Parse(pid);
                InitInfo(productid);
            }
            catch (Exception ex)
            {
                
            }           
        }
    }
    private void InitInfo(int productId)
    {
        Product obj = ProductDetailViewer.GetDetail(productId);
        lblProductName.InnerText = obj.ProductName;
        //productimage.Src = "../../Admin/Upload/Image/Product/" + obj.ProductImage;
        productimage.Src = "../" + obj.ProductImage;
        lblPrice.InnerText = string.Format("PRICE: {0} VNĐ", Formatter.PriceVietNamese(obj.ProductPrice));
        lblStatus.InnerText = string.Format("STATUS: {0}", obj.IsActive);
        lblDes.InnerText = obj.ProductDescription;
        imgList.InnerHtml = ProductDetailViewer.ListImage(obj);
        divAddToCart.InnerHtml = string.Format("<a href='javascript:Five.Cart.Add({0})'><img src='../img/layout/addcart.gif' /></a>", productId);
    }
}